package com.cysion.study.ui

import android.os.Bundle
import android.view.View
import com.cysion.study.ktbox.base.BaseActivity
import com.cysion.study.ktbox.utils.whiteTextTheme
import com.cysion.other.color
import com.cysion.other.startActivity_ex
import com.cysion.study.uibox.bar.TopBar
import com.cysion.study.R
import com.cysion.study.constant.BUNDLE_KEY
import com.cysion.study.widget.UIHelper
import kotlinx.android.synthetic.main.activity_choose_ti_type.*

//选择题目类型
class ChooseTiTypeActivity : BaseActivity(), View.OnClickListener {


    override fun getLayoutId(): Int = R.layout.activity_choose_ti_type


    private var courseId=""
    override fun initView() {
        courseId = intent.extras.getString("courseId")
        whiteTextTheme(color(R.color.main_cl))
         topbar.apply {
            setTitle("选择类型")
//            setTexts("添加", TopBar.Pos.RIGHT)
            setOnTopBarClickListener { obj, pos ->
                if (pos == TopBar.Pos.LEFT) {
                    finish()
                }else if (pos == TopBar.Pos.RIGHT) {
//                    startActivity_ex<AddKnowActivity>()//添加习题与知识

                    /*AlertSearch.search(self,""){ confirm: Int, start: String, end: String ->
                        CLog.i("@@@搜索="+start+end)
                        curPage=1
                        getDataList(curPage,start,end)
                    }*/
                }
            }
        }
        ll_sign.setOnClickListener(this)
        ll_muti.setOnClickListener(this)
        ll_ask.setOnClickListener(this)
        ll_pan.setOnClickListener(this)
    }
    override fun onClick(v: View?) {
        var bundle = Bundle()
        bundle.putString("courseId",courseId)
        bundle.putString("type", "2")//1编辑，2新增
        when (v?.id) {
            R.id.ll_sign->{//单选
                bundle.putString("pageType", "1")//pageType  1 单选，2多选
                UIHelper.jump(self, ModifyChooseTiActivity::class.java,bundle)
            }
            R.id.ll_muti->{//多选
                bundle.putString("pageType", "2")//pageType  1 单选，2多选，3解答，4判断
                UIHelper.jump(self, ModifyChooseTiActivity::class.java,bundle)
            }
            R.id.ll_ask->{//解答
                bundle.putString("pageType", "3")//pageType  1 单选，2多选，3解答，4判断
                UIHelper.jump(self, ModifyAnswerTiActivity::class.java,bundle)
            }
            R.id.ll_pan->{//判断
                bundle.putString("pageType", "4")//pageType  1 单选，2多选，3解答，4判断
                UIHelper.jump(self, ModifyJudgeTiActivity::class.java,bundle)
            }
        }
        finish()
    }

    override fun closeMvp() {
    }

}
